package com.yowasa.xiuxian.engine.item.lingyao;

import com.yowasa.xiuxian.annoations.Item;
import com.yowasa.xiuxian.engine.item.ItemInterface;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.enums.ItemTypeEnum;
import com.yowasa.xiuxian.exception.HandlerException;


@Item(name = "续命散", type = ItemTypeEnum.LING_YAO, price = 5000)
public class XuMingSan implements ItemInterface {

    @Override
    public String desc() {
        return "寿命不足10年才能使用 增加20年寿命";
    }

    @Override
    public String effect(UserBO userBO) {
        if (userBO.getUserConfig().getLife() - userBO.getAge() > 10) {
            throw new HandlerException("你还没到生命垂危之时,无法使用续命散");
        }
        userBO.getUserConfig().setLife(userBO.getUserConfig().getLife()+20);
        return "感觉身体变年轻了";
    }




}
